package de.freudenreichdesign.webshop.controller;

import java.util.Date;

import de.freudenreichdesign.webshop.model.Adress;
import de.freudenreichdesign.webshop.model.Article;
import de.freudenreichdesign.webshop.model.Category;
import de.freudenreichdesign.webshop.model.Customer;
import de.freudenreichdesign.webshop.persistence.DatabaseUtil;
import de.freudenreichdesign.webshop.service.AccountService;
import de.freudenreichdesign.webshop.service.ArticleService;
import de.freudenreichdesign.webshop.service.ShoppingService;

public class TestController {

	/**
	 * @param args
	 */
	@SuppressWarnings("deprecation")
	public static void main(String[] args) {
		try {
			Class.forName("de.freudenreichdesign.webshop.persistence.hibernate.HibernateUtil");
			Class.forName("org.gjt.mm.mysql.Driver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		
		AccountService accountService = AccountService.getInstance();
		accountService.createCustomer("Prof.", "Herr", "Torsten", "Pistole", "pistole@email.de",
				"0170123456789", new Date(1980-1900,1,1), "Deutschland", "Berlin", "Berlin", 12345, "Weg", 1, "");
		//System.out.println("Hallo, hier ist " +((Adress) accountService.getCustomerByID(1).getPerson().getListOfAdress().toArray()[0]).getState() + "!");
		System.out.println("Hallo, hier ist " + accountService.getCustomerByID(1).getPerson().getFirstName() + "!");
		accountService.changeCustomerData(1, "Prof.", "Frau", "Gertrud", "Pistole", "g_pistole@web.de", "0170123456789", new Date(1980-1900,1,1));
		System.out.println("Hallo, hier ist " + accountService.getCustomerByID(1).getPerson().getFirstName() + "!");
		
		//ArticleService articleService = ArticleService.getInstance();
		//articleService.createArticle("Musterartikel", "100", "Beautiful Article", "100", "100", "200", 50.43, 0.19f, new Date(2011-1900,1,1), "C:\test.jpg", "C:\test.jpg");
		
		//System.out.println(((Article)articleService.getListOfAllActiveArticles().get(0)).getTitle());
	
		accountService.createAndAddAdress(1, "England", "London", "London Metropol", 12345, "Street", 99, "");
		accountService.createAndAddAdress(1, "England", "London", "London Metropol", 12345, "Street", 99, "");
		
		System.out.println(accountService.getCustomerByID(1).getPerson().getListOfAdresses().size());
		
		//ShoppingService shoppingService = ShoppingService.getInstance();
		//shoppingService.addItemToShoppingCart(1);
		//shoppingService.checkOutShoppingCart(1, 1, 2);
	}

}
